package com.rabbiter.market.controller.user.order;

import com.rabbiter.market.common.web.response.JsonResult;
import com.rabbiter.market.qo.sale_records.QuerySaleRecords;
import com.rabbiter.market.service.sale_management.order.OrderVo;
import com.rabbiter.market.service.sale_management.sale_records.ISaleRecordsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Resource
    private ISaleRecordsService saleRecordsService;

    @GetMapping("/query")
    public JsonResult<List<OrderVo>> queryPageByQoSaleRecords(QuerySaleRecords qo, HttpServletRequest request){
        String token = request.getHeader("token");
        List<OrderVo> orderVoList = saleRecordsService.queryPageByQoSaleRecords(qo, token);
        return JsonResult.success(orderVoList);
    }

}
